package com.edu.web.controller.analysis;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.edu.common.core.domain.AjaxResult;
import com.edu.system.service.analysis.AnalysisService;

/**
 * @author huangc
 *
 */
@RestController
@RequestMapping("/analysis")
public class AnalysisController {

	@Autowired
	private AnalysisService analysisService;

	@PreAuthorize("@ss.hasPermi('analysis:singleStudent')")
	@GetMapping("/singleStudent/{eduId}")
	public AjaxResult singleStudent(@PathVariable("eduId") String eduId) {
		return AjaxResult.success(analysisService.getSingleStudentData(eduId));
	}
	
	@PreAuthorize("@ss.hasPermi('analysis:singleStudent')")
	@GetMapping("/singleStudentRadar/{eduId}")
	public AjaxResult singleStudentRadar(@PathVariable("eduId") String eduId) {
		return AjaxResult.success(analysisService.getSingleStudentRadarData(eduId));
	}
	
	@PreAuthorize("@ss.hasPermi('analysis:getStudentTags')")
	@GetMapping("/getStudentTags/{eduId}")
	public AjaxResult getStudentTags(@PathVariable("eduId") String eduId) {
		return AjaxResult.success(analysisService.getStudentTags(eduId));
	}
	
	@PreAuthorize("@ss.hasPermi('analysis:getHonorsClassAvgScore')")
	@GetMapping(value={"/getHonorsClassAvgScore/{cohort}" , "/getHonorsClassAvgScore"})
	public AjaxResult getHonorsClassAvgScore(@PathVariable(name = "cohort" , required = false) String cohort) {
		return AjaxResult.success(analysisService.getHonorsClassAvgScore(cohort));
	}
	
	@PreAuthorize("@ss.hasPermi('analysis:getHonorsClassTopStudentSummary')")
	@GetMapping(value={"/getHonorsClassTopStudentSummary/{cohort}" , "/getHonorsClassTopStudentSummary"})
	public AjaxResult getHonorsClassTopStudentSummary(@PathVariable(name = "cohort") String cohort) {
		return AjaxResult.success(analysisService.getHonorsClassTopStudentSummary(cohort));
	}
	
	
	@PreAuthorize("@ss.hasPermi('analysis:getTopStudentSummaryByClass')")
	@GetMapping(value={"/getTopStudentSummaryByClass/{classId}" , "/getTopStudentSummaryByClass"})
	public AjaxResult getTopStudentSummaryByClass(@PathVariable(name = "classId") Long classId) {
		return AjaxResult.success(analysisService.getTopStudentSummaryByClass(classId));
	}
	
}
